#! /bin/bash

SCRIPT_DIR="$(
    cd "$(dirname "$0")"
    pwd
)"


ios_build="${SCRIPT_DIR}/ios_build"

if [ -d "${ios_build}" ]; then 
    rm -rf ${ios_build}
fi

mkdir -p ${ios_build}
cd ${ios_build}


# 参考 https://github.com/leetal/ios-cmake
# cmake -j`sysctl -n hw.logicalcpu` .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=${SCRIPT_DIR}/ios.toolchain.cmake -DPLATFORM=OS
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=${SCRIPT_DIR}/ios.toolchain.cmake -DPLATFORM=OS

# cmake --build . -j`sysctl -n hw.logicalcpu` --config Debug
cmake --build . --config Debug

# cmake --install . --prefix "${ios_build}/librtmp" --config Debug

cmake --install . --prefix "${ios_build}/librtmp2" --config Debug

# cmake --install . --prefix "/Users/dingyusong/mine/gitee/ScreenLive/ScreenLive/librtmp" --config Debug
